package com.datatest.riskcheck.service.serviceImpl;

import com.datatest.beans.po.RuleEntity;
import com.datatest.constant.ErrorEnum;
import com.datatest.ex.BusinessException;
import com.datatest.riskcheck.dao.tongdun.RuleMapper;
import com.datatest.riskcheck.service.api.RuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RuleServiceImpl implements RuleService {

    @Autowired
    private RuleMapper ruleMapper;

    @Override
    public List<RuleEntity> selectRules(String risk_event_id) {

        List<RuleEntity> ruleList = ruleMapper.selectRules(risk_event_id);
        if(ruleList.size() == 0) {
            throw new BusinessException(ErrorEnum.NO_RULEERROR.getErrorCode(),ErrorEnum.NO_RULEERROR.getEooroMsg());
        }
        return ruleList;
    }
}
